// 获取输入框
let dom = document.getElementById('inputdom')
// 获取按钮
let startBtn = document.getElementById('start')
let endBtn = document.getElementById('end')

// 开启｜暂停 刷新
function refreshFun(data) {
  chrome.runtime.sendMessage(data)
}

// 通知消息
function notificationsFun(message, icon) {
  const { notifications } = chrome
  notifications.create({
    type: "basic",
    title: "状态",
    message: message,
    iconUrl: `images/${icon}.png`
  })
}

startBtn.onclick = function () {
  if (!dom.value) {
    notificationsFun('请输入条件～', 'successful')
    return null
  }
  refreshFun({
    type: 'start',
    value: dom.value,
    time: 1000
  })
  // 处理通知
  notificationsFun('启动成功！', 'successful')
}

endBtn.onclick = function () {
  refreshFun({
    type: 'end',
    value: dom.value,
    time: 3000
  })
  // 处理通知
  notificationsFun('停止成功！', 'successful')
  return null
}





